package cn.lxh.remote.api;

import cn.lxh.constants.Constants;
import cn.lxh.remote.fallback.RuleFeignApiFallbackFactory;
import cn.lxh.remote.pojo.bo.CalculateMileageFeeBo;
import cn.lxh.remote.pojo.bo.DivideAccountsBo;
import cn.lxh.remote.pojo.result.DivideAccountsResult;
import cn.lxh.remote.pojo.result.MileageFeeResult;
import cn.lxh.remote.pojo.result.WaitFeeResult;
import cn.lxh.result.JSONResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author lxh Create Time: 2023/12/23 17:03
 * RuleFeignApi接口
 */
@FeignClient(value = Constants.Remote.SERVICE_RULE, fallbackFactory = RuleFeignApiFallbackFactory.class)
public interface RuleFeignApi {

    /**
     * 计算里程费用
     * @return
     */
    @PostMapping("/remote/rule/calculateMileageFee")
    JSONResult<MileageFeeResult> calculateMileageFee(@RequestBody @Validated CalculateMileageFeeBo calculateMileageFeeBo);

    /**
     * 计算等时费
     * @return
     */
    @PostMapping("/remote/rule/calculateWaitFee")
    JSONResult<WaitFeeResult> calculateWaitFee(@RequestParam Integer waitMinute);

    /**
     * 计算分账
     * @return
     */
    @PostMapping("/remote/rule/calculateSplitAccounts")
    JSONResult<DivideAccountsResult> calculateSplitAccounts(@RequestBody @Validated DivideAccountsBo divideAccountsBo);
}
